how to share the state data between two function components in React